package com.itbac.controller;

import com.itbac.api.UserService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: BacHe
 * @email: 1218585258@qq.com
 * @Date: 2021/10/21 22:20
 */
@RestController
@RequestMapping("/user")
@RefreshScope // 不加好像不能动态刷新。
public class UserController {



    /**
     * DubboReference 可以
     * Autowired 不行
     * Resource 不行
     * Autowired(required = false)  不行
     */
    @DubboReference
    private UserService userService;

    // 127.0.0.1:8080/user/info
    @GetMapping("/info")
    public String getUserInfo(){
        return userService.getUserInfo()+System.currentTimeMillis();
    }



}
